/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DigitShopAdminCustomerForm.java
 *
 * Created on 31-Mar-2011, 4:48:44 PM
 */

package digitshopadminapp;

import java.awt.Color;
import org.jdesktop.application.Action;

/**
 *
 * @author Amarjit
 */
public class DigitShopAdminCustomerForm extends javax.swing.JDialog {

    /** Creates new form DigitShopAdminCustomerForm */
    public DigitShopAdminCustomerForm(java.awt.Frame parent) {
        super(parent);
        initComponents();
         lblPopup.setForeground(Color.red);
        //getRootPane().setDefaultButton(closeButton);
    }

    @Action public void closeCustomerForm() {
        dispose();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
//    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnSubmit = new javax.swing.JButton();
        lblName = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        txtName = new javax.swing.JTextField();
        lblEmail = new javax.swing.JLabel();
        lblAddr = new javax.swing.JLabel();
        txtEmailid = new javax.swing.JTextField();
        lblPhone = new javax.swing.JLabel();
        txtPhoneNo = new javax.swing.JTextField();
        txtConfirm = new javax.swing.JTextField();
        lblCity = new javax.swing.JLabel();
        txtAddr = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        lblZip = new javax.swing.JLabel();
        lblPopup = new javax.swing.JLabel();
        txtCity = new javax.swing.JTextField();
        lblPwd = new javax.swing.JLabel();
        txtZip = new javax.swing.JTextField();
        txtPassword = new javax.swing.JTextField();
        lblConfirm = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(digitshopadminapp.DigitShopAdminApp.class).getContext().getResourceMap(DigitShopAdminCustomerForm.class);
        btnSubmit.setText(resourceMap.getString("btnSubmit.text")); // NOI18N
        btnSubmit.setName("btnSubmit"); // NOI18N
        btnSubmit.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnSubmitMouseClicked(evt);
            }
        });
        btnSubmit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSubmitActionPerformed(evt);
            }
        });

        lblName.setText(resourceMap.getString("lblName.text")); // NOI18N
        lblName.setName("lblName"); // NOI18N

        jLabel9.setFont(resourceMap.getFont("jLabel9.font")); // NOI18N
        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        txtName.setName("txtName"); // NOI18N

        lblEmail.setText(resourceMap.getString("lblEmail.text")); // NOI18N
        lblEmail.setName("lblEmail"); // NOI18N

        lblAddr.setText(resourceMap.getString("lblAddr.text")); // NOI18N
        lblAddr.setName("lblAddr"); // NOI18N

        txtEmailid.setName("txtEmailid"); // NOI18N

        lblPhone.setText(resourceMap.getString("lblPhone.text")); // NOI18N
        lblPhone.setName("lblPhone"); // NOI18N

        txtPhoneNo.setName("txtPhoneNo"); // NOI18N

        txtConfirm.setName("txtConfirm"); // NOI18N

        lblCity.setText(resourceMap.getString("lblCity.text")); // NOI18N
        lblCity.setName("lblCity"); // NOI18N

        txtAddr.setName("txtAddr"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        lblZip.setText(resourceMap.getString("lblZip.text")); // NOI18N
        lblZip.setName("lblZip"); // NOI18N

        lblPopup.setText(resourceMap.getString("lblPopup.text")); // NOI18N
        lblPopup.setName("lblPopup"); // NOI18N

        txtCity.setName("txtCity"); // NOI18N

        lblPwd.setText(resourceMap.getString("lblPwd.text")); // NOI18N
        lblPwd.setName("lblPwd"); // NOI18N

        txtZip.setName("txtZip"); // NOI18N

        txtPassword.setName("txtPassword"); // NOI18N

        lblConfirm.setText(resourceMap.getString("lblConfirm.text")); // NOI18N
        lblConfirm.setName("lblConfirm"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 358, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblConfirm)
                                .addGap(39, 39, 39))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblPwd)
                                .addGap(75, 75, 75))
                            .addComponent(lblZip, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblCity)
                                .addGap(106, 106, 106))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblAddr, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(72, 72, 72))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblEmail)
                                .addGap(87, 87, 87))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblName)
                                .addGap(95, 95, 95))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblPhone, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(38, 38, 38)))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtConfirm, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(txtPassword)
                                .addComponent(txtZip)
                                .addComponent(txtCity)
                                .addComponent(txtAddr)
                                .addComponent(txtPhoneNo)
                                .addComponent(txtEmailid)
                                .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(34, 34, 34)
                        .addComponent(btnSubmit)
                        .addGap(75, 75, 75))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblPopup, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPopup)
                    .addComponent(jLabel1))
                .addGap(17, 17, 17)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lblName)
                        .addGap(24, 24, 24)
                        .addComponent(lblEmail)
                        .addGap(24, 24, 24)
                        .addComponent(lblPhone)
                        .addGap(24, 24, 24)
                        .addComponent(lblAddr)
                        .addGap(18, 18, 18)
                        .addComponent(lblCity)
                        .addGap(24, 24, 24)
                        .addComponent(lblZip)
                        .addGap(18, 18, 18)
                        .addComponent(lblPwd, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(lblConfirm))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(24, 24, 24)
                        .addComponent(txtEmailid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtPhoneNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtCity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(24, 24, 24)
                        .addComponent(txtZip, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtConfirm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnSubmit))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnSubmitMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSubmitMouseClicked



        if(txtName.getText().length() == 0
                || txtEmailid.getText().length() == 0
                || txtPhoneNo.getText().length()==0
                || txtAddr.getText().length()==0
                || txtAddr.getText().length()==0
                || txtZip.getText().length()==0
                || txtPassword.getText().length()==0
                || txtConfirm.getText().length()==0
                ) {
            lblPopup.setText("Fill mandatory fields");
        }else{
            lblPopup.setText("");
        }
        //validation successful, proceed and save customer to database


    }//GEN-LAST:event_btnSubmitMouseClicked

    private void btnSubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitActionPerformed
        // TODO add your handling code here:
        if(txtName.getText().length() == 0
                || txtEmailid.getText().length() == 0
                || txtPhoneNo.getText().length()==0
                || txtAddr.getText().length()==0
                || txtAddr.getText().length()==0
                || txtZip.getText().length()==0
                || txtPassword.getText().length()==0
                || txtConfirm.getText().length()==0
            )
        {
            lblPopup.setText("Fill mandatory fields");
        }else{
            lblPopup.setText("");
        }
}//GEN-LAST:event_btnSubmitActionPerformed
//
//    /**
//    * @param args the command line arguments
//    */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                DigitShopAdminCustomerForm dialog = new DigitShopAdminCustomerForm(new javax.swing.JFrame(), true);
//                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
//                    public void windowClosing(java.awt.event.WindowEvent e) {
//                        System.exit(0);
//                    }
//                });
//                dialog.setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnSubmit;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel lblAddr;
    private javax.swing.JLabel lblCity;
    private javax.swing.JLabel lblConfirm;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblName;
    private javax.swing.JLabel lblPhone;
    private javax.swing.JLabel lblPopup;
    private javax.swing.JLabel lblPwd;
    private javax.swing.JLabel lblZip;
    private javax.swing.JTextField txtAddr;
    private javax.swing.JTextField txtCity;
    private javax.swing.JTextField txtConfirm;
    private javax.swing.JTextField txtEmailid;
    private javax.swing.JTextField txtName;
    private javax.swing.JTextField txtPassword;
    private javax.swing.JTextField txtPhoneNo;
    private javax.swing.JTextField txtZip;
    // End of variables declaration//GEN-END:variables

}
